<?php
/**
 * Created by PhpStorm.
 * User: Powerless
 * Date: 2017-4-21
 * Time: 14:15
 */

namespace app\login\controller;

use cmf\controller\HomeBaseController;
use think\Request;

class IndexController extends HomeBaseController
{
    public function index()
    {
        return $this->fetch(":index");
    }

    public function signOut()
    {
        return $this->fetch(":index");
    }

    public function register()
    {
        return $this->fetch(":register");
    }
    public function guide()
    {
        return $this->fetch(":guide");
    }
    public function verify()
    {
        $verify = input("post.verify");
        if(empty($verify)){
            $code = 0;
            $data = '验证码不能为空';
        }elseif(!cmf_captcha_check($verify)){
            $code = 0;
            $data = '验证码填写错误';
        }else{
            $code = 1;
            $data = '验证通过';
        }
        $result = [
            'data' => $data,
            'code' => $code,
            'token' => 'null',
            'time' => $_SERVER['REQUEST_TIME'],
            'content'  => input('param.'),
        ];
        echo json_encode($result);
    }

    public function postData()
    {
        $url = input("post.url");
        $data = Request::instance()->post('data/a');
        if($url && $data){
            $this->httpPost(HTTP_WEB.$url,$data);
        }
    }
}